<!DOCTYPE html>
<html lang="en-US">
<!--********************************************-->
<!--*       Generated from PreTeXt source      *-->
<!--*                                          *-->
<!--*         https://pretextbook.org          *-->
<!--*                                          *-->
<!--********************************************-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
</head>
<body class="ignore-math">
<h3 class="heading"><span class="type">Paragraph</span></h3>
<p>Find the Fourier series for a periodic function <span class="process-math">\(f(x)\)</span> with period <span class="process-math">\(2\pi\)</span></p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
f(x)=\left\{\begin{array}{rl}-1, &amp; \text{if~} -\pi&lt;x&lt;0\\
1,  &amp; \text{if~} 0&lt;x&lt;\pi\end{array}\right.,\qquad f(x+2\pi)=f(x).
\end{equation*}
</div>
<p class="continuation"><dfn class="terminology">Solution:</dfn> We use the Euler-Fourier formulas with <span class="process-math">\(L = \pi\text{:}\)</span></p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
a_0=\frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \textrm{d}x=\frac{1}{\pi}\left[\int_{-\pi}^{0} -1 \textrm{d}x + \int_{0}^{\pi} 1 \textrm{d}x\right].
\end{equation*}
</div>
<p class="continuation">(Or note that <span class="process-math">\(f (x)\)</span> is an odd function. While integrating over a period, one get 0.)For <span class="process-math">\(n \geq 1\text{,}\)</span> we have</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\begin{aligned} a_n &amp;= \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos nx\textrm{d}x\\
&amp;= \frac{1}{\pi}\int_{-\pi}^{0} -\cos nx \textrm{d}x + \frac{1}{\pi}\int_{0}^{\pi} \cos nx \textrm{d}x\\
&amp;= \frac{1}{\pi}(-\frac{1}{n})\sin nx|_{x=-\pi}^0 + \frac{1}{\pi}\frac{1}{n}\sin nx|_{0}^{\pi}=0.\end{aligned}
\end{equation*}
</div>
<p class="continuation">(Or, <span class="process-math">\(f(x)\)</span> is odd, and <span class="process-math">\(\cos nx\)</span> is even. Then, the product <span class="process-math">\(f (x) \cos nx\)</span> is odd. The integral over an entire period is 0.)Finally, we compute <span class="process-math">\(b_n\)</span> as</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\begin{aligned} b_n &amp;= \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin nx\textrm{d}x\\
&amp;= \frac{1}{\pi}\int_{-\pi}^{0} -\sin nx \textrm{d}x + \frac{1}{\pi}\int_{0}^{\pi} \sin nx \textrm{d}x\\
&amp;= -\frac{1}{\pi n}(-\cos nx)|_{x=-\pi}^0 + \frac{1}{\pi n}(-\cos nx)|_{0}^{\pi}\\
%                 &amp;= -\frac{1}{\pi n}(-1+\cos(-n\pi))+ \frac{1}{\pi n}(-\cos n\pi +1)\\
&amp;= \frac{2}{n\pi}(1-\cos n\pi).\end{aligned}
\end{equation*}
</div>
<p class="continuation">(Or, <span class="process-math">\(\sin nx\)</span> is odd, so <span class="process-math">\(f(x)\sin nx\)</span> is even. The integrals on <span class="process-math">\([-\pi,0]\)</span> and <span class="process-math">\([0,\pi]\)</span> are the same. So one needs to do only one integral, and multiply the result by 2.)Then</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
b_n=\frac{2}{n\pi}(1-(-1)^n)=\left\{\begin{array}{rl}\frac{4}{n\pi},\qquad n \text{ odd},\\
0, \qquad n\text{ even}.\end{array}\right.
\end{equation*}
</div>
<p class="continuation">Since all <span class="process-math">\(a_n's\)</span> are 0 and <span class="process-math">\(b_n\)</span> is nonzero only for odd <span class="process-math">\(n\text{,}\)</span> we will only have sine functions. We can now write out the Fourier series with the first few terms.</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\hat{f}(x)=\frac{4}{\pi}\left[\sin x+\frac{1}{3}\sin 3x +\frac{1}{5}\sin 5x +\frac{1}{7} \sin 7x+\cdots\right].
\end{equation*}
</div>
<p class="continuation"><dfn class="terminology">Partial sum of a series:</dfn> The sum of the first few terms, while truncating the rest.We can write <span class="process-math">\(y_n(x)\)</span> to be the sum of the first <span class="process-math">\(n\)</span> term in the Fourier series. For our example, we have</p>
<div class="displaymath process-math" data-contains-math-knowls="">
\begin{equation*}
\begin{aligned}
y_1(x) &amp;=&amp; \frac{4}{\pi}\sin x\\
y_2(x) &amp;=&amp; \frac{4}{\pi}[\sin x+\frac{1}{3}\sin 3x]\\
y_3(x) &amp;=&amp; \frac{4}{\pi}[\sin x+\frac{1}{3}\sin 3x +\frac{1}{5}\sin 5x]\\
&amp;\cdots &amp;
\end{aligned}
\end{equation*}
</div>
<p class="continuation">Then, the limit <span class="process-math">\(\displaystyle\lim_{n\to\infty} y_n(x)\)</span> (if it converges) gives the whole Fourier series.</p>
<span class="incontext"><a href="sec7_3.html#p-342" class="internal">in-context</a></span>
</body>
</html>
